package com.xs.partnermatching.common;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.io.Serializable;

/**
 * 通用返回类
 *
 * @author lambor
 * @param <T>
 */
@Data
@AllArgsConstructor
public class BaseResponse <T> implements Serializable {

    private static final long serialVersionUID = -6278603665181314119L;

    private int code;

    private T data;

    private String message;

    private String description;

    public BaseResponse(int code, T data) {
        this(code, data, "", "");
    }

    public BaseResponse(int code, T data, String message) {
        this(code, data, message, "");
    }

    public BaseResponse(ErrorCode errorCode) {
        this(errorCode.getCode(), null, errorCode.getMessage(), errorCode.getDescription());
    }
}
